package com.summer.data.demo.service;

import com.summer.data.Jsql;
import com.summer.data.connection.Session;
import com.summer.data.connection.SessionFactory;

import java.util.List;
import java.util.Map;

public class JsqlService {

    SessionFactory sessionFactory;

    public List<Map<String, Object>> queryDemo(Integer resId) {
        Session session = sessionFactory.openSession();

        Jsql jsql = new Jsql();
        jsql.append("select * from demo where res_id < ?", resId);
        List<Map<String, Object>> data = session.query(jsql);

        session.executeUpdate(jsql);

        return data;
    }
}
